{include file="public/headerbase" /} {include file="public/left" /}
<div class="right-content">
	<ol class="breadcrumb we7-breadcrumb">
		<li>
			<a href="{:url('Qiye/index')}">企业介绍</a>
		</li>
		<li>
			添加优惠券
		</li>
	</ol>
	<div class="clearfix">
		<form action="{:url('Qiye/addxinx')}" method="post" class="we7-form" role="form" id="form1" enctype="multipart/form-data">
			
			<div class="form-group">
				<label class="col-sm-2 control-label">缩略图</label>
				<div class="col-sm-8">
				<input type="file" name="qimg" id="file0" multiple="multiple"/><br><img src="__PUBLIC__/images/img.jpg" id="img0" style="height:100px;">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">公司名称</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="qname" id="name" value="" placeholder="公司名称" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">公司简介</label>
				<div class="col-sm-8">
					<textarea name="qcontent" style="height:100px;" id="content" placeholder="公司简介"></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">公司地址</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="qaddress" id="address" value="" placeholder="公司地址" />
				</div>
			</div>

			<div class="form-group">
				<div class="">
					<input type="submit" class="btn btn-primary" onclick="tijiao();"value="提交" />
				</div>
			</div>
		</form>
	</div>
	<script>
	$(function(){
		$('#form1').submit(function(){
			if(!$.trim($(':text[name="qname"]').val())) {
				util.message('请填写新闻标题', '', 'error');
				return false;
			}
			if(!$.trim($(':textarea[name="qcontent"]').val())) {
				util.message('请选择新闻分类', '', 'error');
				return false;
			}
			if(!$.trim($(':text[name="qaddress"]').val())) {
				util.message('请填写新闻内容', '', 'error');
				return false;
			}
			return true;
		});
	});
		$("#file0").change(function(){
			var objUrl = getObjectURL(this.files[0]) ;
			console.log("objUrl = "+objUrl) ;
			if (objUrl) {
			$("#img0").attr("src", objUrl) ;
			}
		}) ;
		//建立一個可存取到該file的url
		function getObjectURL(file) {
			var url = null ; 
			if (window.createObjectURL!=undefined) { // basic
				url = window.createObjectURL(file) ;
			} else if (window.URL!=undefined) { // mozilla(firefox)
				url = window.URL.createObjectURL(file) ;
			} else if (window.webkitURL!=undefined) { // webkit or chrome
				url = window.webkitURL.createObjectURL(file) ;
			}
			return url ;
		}
	</script>
</div>
</div>
</div>
</div>
</div>
{include file="public/footer" /}